package com.qf.java2201.web;

import com.qf.java2201.pojo.HUserinfo;
import com.qf.java2201.service.UserInfoService;
import com.qf.java2201.service.impl.UserInfoServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @date 2022/4/8
 * @desc
 */
@WebServlet("/showDoctor")
public class ShowDoctorServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //科室id
        String tid = req.getParameter("tid");

        //根据 科室  查询  用户详情表里面的医生列表

        UserInfoService userInfoService = new UserInfoServiceImpl();

        List<HUserinfo> list = userInfoService.findUserInfoByKsid(tid);

        //因为 页面上 域对象取得是  uis ，所以这里放的key 必须是 uis
        req.setAttribute("uis",list);
        // 展示该科室下的医生信息
        req.getRequestDispatcher("/sd.jsp").forward(req,resp);

    }
}
